package es.deusto.programacionIV.calculator.model;

/**
 * This abstract type simplifies the process of implementing the toString and equals methods
 * for all the operation type subclasses. 
 * toString: Converting an operation type to a string is a matter of returning the name of the operation type.
 * equals: Two operation types are equal if the names of both are the same. 
 * 
 * @author Iker Jamardo Zugaza
 *
 */
public abstract class OperationTypeAbstract implements OperationType
{
	@Override
	public String toString()
	{
		return getName();
	}
	
	@Override
	public boolean equals(Object object)
	{
		if (this == object) return true;
		boolean result = false;
		if (object instanceof OperationType)
		{
			OperationType operationType = (OperationType)object;
			result = this.getName().equals(operationType.getName());
		}
		return result;
	}
}
